package com.aaa.day117.demo1;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @Description:
 * @author:LiWei
 * @date:2022年11月07日13:09
 */
public class Test {
    public static void main(String[] args) {
        DateTimeFormatter dateTimeFormatter=DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
        LocalDateTime localDateTime=LocalDateTime.parse("2020/11/17 22:22:22", dateTimeFormatter);
        System.out.println(localDateTime);
    }

    private static void format(){
        LocalDateTime now=LocalDateTime.now();
        System.out.println("转化前的时间 = " + now);
        DateTimeFormatter dateTime=DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
        String format=now.format(dateTime);
        System.out.println("转化后的时间 = " + format);
    }
}
